package com.qdu.servlet;

import com.qdu.entity.Users;
import com.qdu.service.UsersService;
import com.qdu.service.impl.UsersServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author 24959
 */
@WebServlet("/ass")
public class AddUserServlet extends HttpServlet {
    UsersService ss = new UsersServiceImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {


        
        req.setCharacterEncoding("utf-8");
        int Uno = Integer.parseInt(req.getParameter("Uno"));
        String Uname = req.getParameter("Uname");
        String Upwd = req.getParameter("Upwd");
        String Uquestion = req.getParameter("Uquestion");
        String Uanswer = req.getParameter("Uanswer");
        String Uid = req.getParameter("Uid");
        String Ugender = req.getParameter("Ugender");
        String Uphone = req.getParameter("Uphone");
        String Ucity = req.getParameter("Ucity");
        String Uocp = req.getParameter("Uocp");
        String Uemail = req.getParameter("Uemail");


        Users newUsers = new Users(Uno, Uname, Upwd, Uquestion, Uanswer, Uid, Ugender, Uphone, Ucity, Uocp, Uemail);
        int rows =  ss.addNewUsers(newUsers);
     

        resp.getWriter().println(rows);
        
        
    }
}